import 'package:flutter_blue_plus/flutter_blue_plus.dart';

class HKPeripheralInfo {
  final int? rssi; // RSSI 信号强度
  final BluetoothDevice? peripheral; // 蓝牙设备
  final Map<String, dynamic>? advertisementData; // 广播数据
  final String? macString; // MAC 地址

  HKPeripheralInfo({
    this.rssi,
    this.peripheral,
    this.advertisementData,
    this.macString,
  });

  // 可选：添加一个 fromJson 工厂方法，用于从 JSON 数据创建对象
  factory HKPeripheralInfo.fromJson(Map<String, dynamic> json) {
    return HKPeripheralInfo(
      rssi: json['RSSI'],
      peripheral: json['peripheral'],
      advertisementData: json['advertisementData'],
      macString: json['macString'],
    );
  }

  // 可选：添加一个 toJson 方法，用于将对象转换为 JSON
  Map<String, dynamic> toJson() {
    return {
      'RSSI': rssi,
      'peripheral': peripheral,
      'advertisementData': advertisementData,
      'macString': macString,
    };
  }
}
